class MyCircularQueue1 {
    private int[]elems;

    private int front;
    private int rear;

    public MyCircularQueue1(int k) {
        elems=new int[k+1];
    }
    
    public boolean enQueue(int value) {
        if(isFull()){
            return false;
        }
        else{
            elems[rear]=value;
            rear=(rear+1)%elems.length;
        }
        return true;
    }
    
    public boolean deQueue() {
        if(isEmpty()){
            return false;
        }
        else{
            front=(front+1)%elems.length;
        }
        return true;
    }
    
    public int Front() {
        if(isEmpty()){
            return -1;
        }else{
            return elems[front];
        }


    }
    
    public int Rear() {
        if(isEmpty()){
            return -1;
        }
        int dex=rear==0?elems.length-1:rear-1;
        return elems[dex];
    }
    
    public boolean isEmpty() {

        return rear==front;


    }
    
    public boolean isFull() {
       return (rear+1)%elems.length==front;
    }
}